package com.ruoyi.cms.controller.website;

import com.ruoyi.cms.domain.CmsFeedback;
import com.ruoyi.cms.service.ICmsFeedbackService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 在线留言反馈Controller
 *
 * @author houyong
 * @date 2025-11-18
 */
@Tag(name = "CmsWebSiteFeedbackController", description = "在线留言管理")
@RestController
@RequestMapping("cms/website/feedback")
public class CmsWebSiteFeedbackController extends BaseController {
    @Autowired
    private ICmsFeedbackService cmsFeedbackService;

    /**
     * 新增在线留言反馈
     */
    @Log(title = "在线留言反馈", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CmsFeedback cmsFeedback) {
        cmsFeedback.setStatus(0L); // 默认状态为待处理
        cmsFeedback.setCreateTime(new Date()); // 设置创建时间
        return toAjax(cmsFeedbackService.insertCmsFeedback(cmsFeedback));
    }

}